package state;

/**
 * @author mubei
 * @date 2021/11/20
 * @description
 */
public class TestDaemon {

    public static void main(String[] args) {
        God god = new God();
        You you = new You();

        Thread thread = new Thread(god);
        //默认是false表示是用户线程  正常的线程都是用户线程
        thread.setDaemon(true);

        thread.start();

        new Thread(new You()).start();
    }
}

class God implements Runnable {
    @Override
    public void run() {
        while(true){
            System.out.println("ah守护着你");
        }
    }
}

class You implements Runnable {

    @Override
    public void run() {
        for (int i = 0; i < 36500; i++) {
            System.out.println("快乐的一天"+i);
        }
        System.out.println("ah goodbye");
    }
}
